<html>
<head><meta charset="utf-8"><title>How to run doc tests in libcore · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html">How to run doc tests in libcore</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200635750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/How%20to%20run%20doc%20tests%20in%20libcore/near/200635750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html#200635750">(Jun 12 2020 at 05:17)</a>:</h4>
<p>I've just started contributing to the compiler, and am having some trouble getting the doctests in libcore to run. For testing purposes, I've replaced one of them with <code>assert!(false);</code> and since I haven't gotten any failures I'm assuming they're not running. What I've tried to far is to run <code>./x.py test --stage 1 src/libcore</code> and the same with the addition of the <code>--doc</code> flag. In the <code>--doc</code> case, the last line of output indicated that the build succesfully completed in some amount of time; without the <code>--doc</code>, some tests were also run but none of them failed, so I'm assuming thats not the doctests. What is the right procedure here?</p>



<a name="200665586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/How%20to%20run%20doc%20tests%20in%20libcore/near/200665586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html#200665586">(Jun 12 2020 at 12:50)</a>:</h4>
<p>See also <a class="stream" data-stream-id="182449" href="/#narrow/stream/182449-t-compiler.2Fhelp">#t-compiler/help</a></p>



<a name="200709713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/How%20to%20run%20doc%20tests%20in%20libcore/near/200709713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html#200709713">(Jun 12 2020 at 18:51)</a>:</h4>
<p><span class="user-mention" data-user-id="310518">@Jake</span> doc tests are currently broken for std/core, I'm working on a fix.</p>



<a name="200711685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/How%20to%20run%20doc%20tests%20in%20libcore/near/200711685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html#200711685">(Jun 12 2020 at 19:06)</a>:</h4>
<p>As a temporary workaround, the following should work:</p>
<p><code>CARGOFLAGS_NOT_BOOTSTRAP=-Zdoctest-xcompile ./x.py test --stage=0 src/libcore --doc</code></p>



<a name="200747278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/How%20to%20run%20doc%20tests%20in%20libcore/near/200747278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/How.20to.20run.20doc.20tests.20in.20libcore.html#200747278">(Jun 13 2020 at 03:43)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> ah, thanks. This worked, but only after switching to <code>--stage=1</code>. Regardless, I appreciate the help</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>